Scripting languages offer simplicity and ease of development to software developers. Script code is easy to write since scripting languages are often based on a small set of expressions and statements that are simple to learn. Software developers often use scripting languages for rapid development of applications, for example, web applications. Scripting languages may be used for server side programs or for client side programs. Examples of server side scripting languages include PHP (Personal Home Page) and examples of client side scripting languages include JAVASCRIPT.
Server side script code can be used for executing a user request received at a web server by dynamically generating web pages. Server side scripting is often used for implementation of interactive websites that interface with data stores for retrieving and storing information. The PHP scripting language allows embedding of script code with hypertext markup language (HTML). Client side script code is often used for performing simple computations on the client side rather than sending a request to the server for simple computations.
Conventional approaches to execute script code include executing the script code using an interpreter. However, an interpreter may not be able to perform several optimizations that a compiler that generates executable code can perform. Therefore, interpreting script code can be inefficient compared to running executable code obtained by compiling the script code. Most compilers translate the source program first to some form of intermediate representation (IR) and convert from there into machine code. The IR is independent of the machine for which the IR is generated, and independent of the source code language it is generated from.
There are many IRs in use but these various representations are not efficient in terms of consumption of computing resources. In some situations, an execution of a destructor can have adverse effects on the code that executes following the execution of the destructor. The current IRs include code for performing checks to handle the adverse effect caused due to the execution of the destructor. However, such checks are performed at every instance a programming construct that can potentially be affected is accessed, and/or every time the program is executed. Further, these checks are executed even in situations where the likelihood of a executing a destructor is less. Accordingly, an executable code generated from the IR includes significant amount of code for performing such checks, which consumes significant computing resources.